/*------------------------------------*\
    #VARIABLES
\*------------------------------------*/

/**
 * List Reset
 */
@mixin listReset() {
  list-style: none;
  margin: 0;
  padding: 0;
}

/**
 * Hide scrollbar
 * 1) This hides scrollbars on Windows devices
 */
@mixin hideScrollBar() {
  -ms-overflow-style: -ms-autohiding-scrollbar;

  &::-webkit-scrollbar {
    width: 0 !important;
  }
}

/**
 * Header Link Style
 */
@mixin linkStyle() {
  @include noSelect;
  color: inherit;
  text-decoration: none;
  line-height: 1;
  padding: 0.7rem 0.5rem;
  border: 0;
  text-align: left;
  transition: background-color $pl-animate-quick ease-out,
    color $pl-animate-quick ease-out;
  cursor: pointer;

  &:hover,
  &.pl-is-active:hover {
    background-color: rgba(0, 0, 0, 0.1);
  }

  /**
     * Header link styles inside light theme
     */

  /**
     * Header link styles inside cozy theme
     */
  .pl-c-body--theme-density-cozy & {
    font-size: $pl-font-size-sm-2;
    padding: 1.2rem 0.8rem;
  }

  /**
     * Header link styles inside comfortable theme
     */
  .pl-c-body--theme-density-comfortable & {
    font-size: $pl-font-size-sm-2;
    padding: 1.5rem 1rem;
  }
}

/**
 * Accordion panel
 */
@mixin accordionPanel() {
  overflow: hidden;
  max-height: 0;
  transition: all $pl-animate-quick ease-out;

  /**
  * Active styles for when the accordion panel is open
  * 1. WIP -- part of broader UI refactor
  */
  &.pl-is-active {
    max-height: calc(95vh - #{$offset-top} - 1rem);
    max-height: calc(
      var(--pl-viewport-height, calc(95vh - #{$offset-top})) - 1rem
    ); /* [1] */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@mixin noSelect() {
  -webkit-user-select: none; /* Chrome all / Safari all */
  -moz-user-select: none; /* Firefox all */
  -ms-user-select: none; /* IE 10+ */
  user-select: none; /* Likely future */
}

@mixin buttonStyles() {
  color: inherit;
  text-decoration: none;
  background: transparent;
  border: 0;
  appearance: none;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  flex-direction: row-reverse;
  justify-content: flex-end;
  cursor: pointer;
  position: relative;
  min-width: 30px;

  &::after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    background-color: currentColor;
  }

  // &:focus,
  &:hover {
    &::after {
      opacity: 0.1;
    }
  }

  &:active:hover {
    &::after {
      opacity: 0.2;
    }
  }

  &:focus {
    outline: 1px dotted;
    outline-offset: -1px;

    &::after {
      opacity: 0.1;
    }
  }
}
